package com.thermal.thermal_inspection.mapper;

import com.thermal.thermal_inspection.entity.Inspection;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.List;

@Repository
@Mapper
public interface InspectionMapper {
    /**
     * 通过巡检任务名获得巡检任务
     */
    Inspection getInspectionByName(String inspectionName);

    /**
     * 新增巡检任务
     */
    int addInspection(String inspectionName, Timestamp inspectionDate, int inspectionUserId, int inspectionClassId, int inspectionMapId);

    /**
     * 通过id获取巡检任务
     */
    Inspection getInspectionById(int inspectionId);
    /**
     * 获取所有任务模版
     */
    List<Inspection> getAllInspectionTemplates();

    /**
     * 把inspection表里面的inspection_map_id设置成-1
     */
    int deleteMap(int mapId);

    /**
     * 修改巡检任务
     */
    int changeInspection(int inspectionId, int inspectionMapId, String inspectionName, int inspectionUserId, int inspectionClassId);

    /**
     * 删除巡检任务
     */
    int deleteInspection(int inspectionId);

    /**
     * 通过mapId获取inspection列表
     */
    List<Inspection> getInspectionByMap(int mapId);

    /**
     * 根据创建者or模板名称or负责班组搜索模板
     */
    List<Inspection> searchInspectionTemplate(String inspectionName, Integer inspectionUserId, Integer inspectionClassId);
}
